/**
 * 
 */
package com.java.test.user.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author 提款类型管理
 *
 */
public class DrawingTypeInfo implements RowMapper<DrawingTypeInfo> {

	// 主键
	private int id;

	// 排序
	private int sort;

	// 类型名称
	private String typeName;

	// 备注
	private String content;

	// 添加时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime addTime;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public LocalDateTime getAddTime() {
		return addTime;
	}

	public void setAddTime(LocalDateTime addTime) {
		this.addTime = addTime;
	}

	@Override
	public DrawingTypeInfo mapRow(ResultSet rs, int rowNum) throws SQLException {

		DrawingTypeInfo info = new DrawingTypeInfo();
		info.setId(rs.getInt("id"));
		info.setSort(rs.getInt("sort"));
		info.setTypeName(rs.getString("type_name"));
		info.setAddTime(rs.getTimestamp("add_time") == null ? null
				: rs.getTimestamp("add_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setContent(rs.getString("content"));
		return info;
	}

}
